#include "BMD31M090.h"
#include "Bitmap.h"

#define BMD31M090_WIDTH   128        // BMD31M090 Module display width, in pixels
#define BMD31M090_HEIGHT  64         // BMD31M090 Module display height, in pixels
#define BMD31M090_ADDRESS 0x3C       // See Schematic "I2C Addr SEL" for address setting,
                                     // The I2C address can configure: Addr0:0x3C ; Addr1:0x3D

uint8_t t = ' ';

BMD31M090     BMD31(BMD31M090_WIDTH, BMD31M090_HEIGHT, &Wire); //Please uncomment out this line of code if you use HW Wire on BMduino
//BMD31M090     BMD31(BMD31M090_WIDTH, BMD31M090_HEIGHT, &Wire1); //Please uncomment out this line of code if you use HW Wire1 on BMduino
//BMD31M090     BMD31(BMD31M090_WIDTH, BMD31M090_HEIGHT, &Wire2); //Please uncomment out this line of code if you use HW Wire1 on BMduino

void setup()
{
  Serial.begin(115200);
  Serial.println("BMD31M090 0.96\" OLED Module Sketch");

  BMD31.begin(BMD31M090_ADDRESS);
  delay(100); // Recommended initial setting delay value.

  /* Test Function: drawString to draw font(6x8) Hello World! */
  test_drawString_6x8();
}

void loop() {

}


void test_drawString_6x8(void)
{
  BMD31.clearDisplay();
  BMD31.display();

  uint8_t col, row;

  BMD31.setFont(FontTable_6X8); // Set Font Type - 6X8 (Default Font Type : 8X16)

  col = (128 - (6 * sizeof("Hello World!"))) / 2;
  for (row=0; row<8; row++)
  {
    BMD31.drawString(col, row, (u8*)"Hello World!");
  }
  delay(500);
}